<!DOCTYPE html>
<html lang="en">
<head>
    <include file="Public:header2" />
    <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Home/js/jquery.cookies.2.2.0.js"></script>
</head>
<style type="text/css">

</style>
<body class="blackbg">
    <div id="container" class="logbg">
        <div class="log_title">
            <span class="back"><a href="javascript:history.go(-1)"></a></span>
            {:L('设置交易密码')}
        </div>
        <div class="logbot">
            <form>
                
                <input type="password" placeholder="{:L('交易密码')}" class="logipt" id="set_paypassword">
                <p style="font-size:14px;line-height:24px;color:#ff8800;padding-left:10px;">
                    {:L('警告：交易密码不要与登录密码或者其他网站密码一致，由此产生的账号被盗，本站概不负责。')}
                </p>
                <input type="password" placeholder="{:L('重复密码')}" class="logipt" id="set_paypassword">
                <div class="yzmbox">
                    <input type="text" placeholder="{:L('验证码')}" class="logipt yzmipt"  id="mobile_verify" >
                    <input type="button" value="{:L('获取验证码')}" class="phonebut" id="regBtn"  value="{:L('获取验证码')}" onclick="SendCode()" style="margin-top:15px;background:#ff9900;color:#fff;">
                	<p id="repassword-msg" data-explain="{:L('重复输入密码，两次需要一致')}<em></em>" style="font-size:14px;line-height:24px;color:#ff8800;padding-left:10px;">{:L('接收短信的手机')}{$mobile}<em></em></p>
                </div>
                <input type="button" class="logbut" value="{:L('保存')}" onclick="Update()">
            </form>
        </div>
    </div>
<script>
  function SendCode() {
  layer.load(0, {shade: [0.5,'#8F8F8F']});
    $('#regBtn').attr("disabled", "disabled");
    $.post("{:U('Verify/paypass')}", {}, function (data) {
    layer.closeAll();
      if (data.status == 1) {
        layer.msg(data.info, {
          icon: 1
        });
        var obj = $('#regBtn');
        var wait = 120;
        var interval = setInterval(function () {
          obj.css('backgroundColor', '#999B9C');
          obj.val(wait + '{:L('秒再次发送')}');
          wait--;
          if (wait < 0) {
            $('#regBtn').removeAttr("disabled");
            clearInterval(interval);
            obj.val('{:L('获取验证码')}');
            obj.css('backgroundColor', '#ff9900');
          }
          ;
        }, 1000);
      } else {
        $('#regBtn').removeAttr("disabled");
        layer.msg(data.info, {
          icon: 2
        });
      }
    }, "json");
  }
  

}
function UpPaypasswordSet() {
    var paypassword = $("#set_paypassword").val();
    var repaypassword = $("#set_repaypassword").val();
    var mobile_verify = $("#set_mobile_verify").val();

    if (paypassword == "" || paypassword == null) {
        layer.tips('{$Think.lang.请输入交易密码}', '#set_paypassword', { tips: 3 });
        return false;
    }
    if (repaypassword == "" || repaypassword == null) {
        layer.tips('{$Think.lang.请输入确认密码}', '#set_repaypassword', { tips: 3 });
        return false;
    }
    if (mobile_verify == "" || mobile_verify == null) {
        layer.tips('{$Think.lang.请输入短信验证码}', '#set_mobile_verify', { tips: 3 });
        return false;
    }

    $.post("{:U('User/uppaypasswordset')}", { mobile_verify: mobile_verify, paypassword: paypassword, repaypassword: repaypassword }, function(data) {
        if (data.status == 1) {
            layer.msg(data.info, { icon: 1 });
            window.setTimeout('window.location="{:U('User/index')}"',1000);
            // window.location = "{:U('User/paypassword')}";
        } else {
            layer.msg(data.info, { icon: 2 });
            if (data.url) {
                window.location = data.url;
            }
        }
    }, "json");
	}
	function remainTime(){ 
		window.location = "{:U('User/index')}";
	}
</script>
</body>
</html>


<!DOCTYPE html>
<html lang="en">
<head>
    <include file="Public:header2" />
    <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Home/js/jquery.cookies.2.2.0.js"></script>
</head>
<style type="text/css">   
</style>
<body class="blackbg">
    <div id="container" class="logbg">
        <div class="log_title">
            <span class="back"><a href="javascript:history.go(-1)"></a></span>
            {:L('修改交易密码')}
        </div>
        <div class="logbot">
            <form>
                <input type="password" placeholder="{:L('原交易密码')}" class="logipt" id="oldpaypassword">
                <input type="password" placeholder="{:L('新交易密码')}" class="logipt" id="newpaypassword">
                <p style="font-size:14px;line-height:24px;color:#ff8800;padding-left:10px;">
                    {:L('警告：交易密码不要与登录密码或者其他网站密码一致，由此产生的账号被盗，本站概不负责。')}
                </p>
                <input type="password" placeholder="{:L('重复密码')}" class="logipt" id="repaypassword">
                <div class="yzmbox">
                    <input type="text" placeholder="{:L('验证码')}" class="logipt yzmipt"  id="mobile_verify" >
                    <input type="button" value="{:L('获取验证码')}" class="phonebut" id="regBtn"  value="{:L('获取验证码')}" onclick="SendCode()" style="margin-top:15px;background:#ff9900;color:#fff;">
                	<p id="repassword-msg" data-explain="{:L('重复输入密码，两次需要一致')}<em></em>" style="font-size:14px;line-height:24px;color:#ff8800;padding-left:10px;">{:L('接收短信的手机')}{$mobile}<em></em></p>
                </div>
                <input type="button" class="logbut" value="{:L('保存')}" onclick="Update()">
            </form>
        </div>
    </div>
<script>
  function SendCode() {
  layer.load(0, {shade: [0.5,'#8F8F8F']});
    $('#regBtn').attr("disabled", "disabled");
    $.post("{:U('Verify/paypass')}", {}, function (data) {
    layer.closeAll();
      if (data.status == 1) {
        layer.msg(data.info, {
          icon: 1
        });
        var obj = $('#regBtn');
        var wait = 120;
        var interval = setInterval(function () {
          obj.css('backgroundColor', '#999B9C');
          obj.val(wait + '{:L('秒再次发送')}');
          wait--;
          if (wait < 0) {
            $('#regBtn').removeAttr("disabled");
            clearInterval(interval);
            obj.val('{:L('获取验证码')}');
            obj.css('backgroundColor', '#ff9900');
          }
          ;
        }, 1000);
      } else {
        $('#regBtn').removeAttr("disabled");
        layer.msg(data.info, {
          icon: 2
        });
      }
    }, "json");
  }
  

	function Update(){
		var repaypassword = $("#repaypassword").val();
		var newpaypassword = $("#newpaypassword").val();
		var oldpaypassword = $("#oldpaypassword").val();
		var mobile_verify = $("#mobile_verify").val();
		
		if (mobile_verify == "" || mobile_verify == null) {
			layer.tips('{:L('请输入短信验证码')}', '#mobile_verify', {tips: 3});
			return false;
		}
		if (oldpaypassword == "" || oldpaypassword == null) {
			layer.tips('{:L('请输入交易密码')}', '#oldpaypassword', {tips: 3});
			return false;
		}
		if (newpaypassword == "" || newpaypassword == null) {
			layer.tips('{:L('请设置6~16位密码，不含特殊符号！')}', '#newpaypassword', {tips: 3});
			return false;
		}

		if (repaypassword == "" || repaypassword == null) {
			layer.tips('{:L('请输入确认新密码')}', '#repaypassword', {tips: 3});
			return false;
		}

		$.post("{:U('User/uppaypassword')}",{mobile_verify : mobile_verify,oldpaypassword : oldpaypassword,newpaypassword : $('#newpaypassword').val(),repaypassword : $('#repaypassword').val() },function(data){
		  if(data.status==1){
			layer.msg(data.info,{icon : 1 });
			setTimeout("remainTime()",3000);
		  }else{
			layer.msg(data.info,{icon : 2 });
			if(data.url){
			  window.location=data.url;
			}
		  }
		},"json");
	}
	function remainTime(){ 
		window.location = "{:U('User/index')}";
	}
</script>
</body>
</html>